<template>
  <ul class="legend-box">
    <li class="f-between item" v-for="(item, index) in data" :key="index">
      <p class="flex align-center gap-10">
        <span class="text-line" :style="{ backgroundColor: item.color||item.itemStyle?.color }"
          >&nbsp;</span
        >
        <span>{{ item.name || item.label }}</span>
      </p>
      <span class="text-value">{{ item.value }}{{ unit }}</span>
    </li>
  </ul>
</template>

<script setup lang="ts">
const props = defineProps<{
  data?: any;
  unit?: string;
}>();
</script>

<style scoped lang="scss">
.legend-box {
  display: flex;
  flex-flow: row wrap;
  gap: 10px;
  position: absolute;
  bottom: 20px;
  .item {
    padding: 2px 6px;
    width: calc(45% - 6px);
    min-height: 20px;
    line-height: 20px;
    background: #d8f0ff1a;
    font-family: "PingFang-SC-Regular ";
    font-weight: 400;
    font-size: 12px;
    text-align: left;
    color: #d8f0ffcc;
    .text-line {
      display: inline-block;
      width: 13px;
      height: 4px;
      background: #6dd1ea;
    }
    .text-value {
      font-family: "Franklin Gothic Medium";
      font-weight: 500;
      font-size: 11px;
      letter-spacing: 0.05px;
      text-align: left;
      color: #fff;
    }
  }
}
</style>
